# # -*- coding: utf-8 -*-
# import time
#
# import pyperclip
# import win32api as api
# import pyautogui
# import cv2
#
#
# def open_wx01():
#     """
#     根据程序句柄打开程序
#     :return:
#     """
#     wx = "C:\\Program Files (x86)\\Tencent\\WeChat\\WeChat.exe"
#     api.ShellExecute(0, 'open', wx, None, None, 1)
#     time.sleep(3)
#
#
# def open_wx02():
#     """
#     使用图像识别找到微信图标并双击打开
#     :return:
#     """
#     wx = pyautogui.locateOnScreen('../../resources/wechat.png')
#     pyautogui.doubleClick(wx)
#     time.sleep(3)
#
#
# def open_wx03():
#     return find_x_y('../../resources/screen_wx.png', '../../resources/input.png')
#
#
# def find_x_y(image_path, find_img_path):
#     """
#     使用 OpenCV 进行模板匹配，找到微信图标的位置并返回中心坐标
#     :return: 微信图标的中心坐标 (x, y)
#     """
#     screen = cv2.imread(image_path)
#     wechat = cv2.imread(find_img_path)
#     result = cv2.matchTemplate(screen, wechat, cv2.TM_CCOEFF_NORMED)
#     pos_start = cv2.minMaxLoc(result)[3]
#     x = int(pos_start[0] + int(wechat.shape[1]) / 2)
#     y = int(pos_start[1] + int(wechat.shape[0]) / 2)
#     return x, y
#
#
# def send_name_to_search(x, y, name):
#     pyautogui.click(x, y)
#     time.sleep(1)
#     pyperclip.copy(name)
#     pyautogui.hotkey('ctrl', 'v')
#     time.sleep(1)
#     pyautogui.hotkey('enter')
#     pyautogui.moveTo(x, y + 80)
#     pyautogui.click(x, y + 80)
#
#
# def send_msg(msg):
#     pyperclip.copy(msg)
#     pyautogui.hotkey('ctrl', 'v')
#     pyautogui.hotkey('enter')
#
#
# if __name__ == '__main__':
#     pyautogui.hotkey('win', 'd')
#     time.sleep(1)
#     im = pyautogui.screenshot()
#     im.save('../../resources/desktop.png')
#
#     x, y = find_x_y('../../resources/desktop.png', '../../resources/wechat.png')
#     pyautogui.doubleClick(x, y)
#     time.sleep(1)
#     im2 = pyautogui.screenshot()
#     im2.save('../../resources/desktop_wechat.png')
#
#     x, y = find_x_y('../../resources/desktop_wechat.png', '../../resources/input.png')
#     pyautogui.click(x, y)
#     time.sleep(1)
#     pyperclip.copy('文件传输助手')
#     pyautogui.hotkey('ctrl', 'v')
#     pyautogui.hotkey('enter')
#     time.sleep(1)
#     pyautogui.moveTo(x, y + 80)
#     pyautogui.click(x, y + 80)
#     send_msg('hello x44444x')
